<?php
echo '<pre>';
$list = array (
    array(' aaa ', ' bbb ', ' ccc ', 'dddd'),
    array('123', '45,6', '789'),
    array('" aaa "', '" bbb "')
);
var_export($list);
$fp = fopen('file.csv', 'w');

foreach ($list as $fields) {
    fputcsv($fp, $fields, ',');
}

fclose($fp);
